package com.zprmb.udzt.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zprmb.udzt.R;
import com.zprmb.udzt.bean.Invatejilubean;

public class Invate_Adapter extends BaseAdapter {
	private List<Invatejilubean> list;
	private Context context;

	public Invate_Adapter(List<Invatejilubean> list, Context context) {
		super();
		this.list = list;
		this.context = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@SuppressWarnings("null")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		Help h;
		if (convertView == null) {
			h = new Help();
			convertView = LayoutInflater.from(context).inflate(
					R.layout.invate_item, null);
			h.tv_num = (TextView) convertView.findViewById(R.id.id_num);
			h.tv_username = (TextView) convertView.findViewById(R.id.user_name);
			h.tv_invest_amount = (TextView) convertView
					.findViewById(R.id.invest_amount);
			convertView.setTag(h);
		} else {
			h = (Help) convertView.getTag();
		}
		h.tv_num.setText(position + 1 + "");
		h.tv_username.setText(list.get(position).getUserMobile());
		h.tv_invest_amount.setText(list.get(position).getInvestAmount());
		return convertView;
	}

	private class Help {
		private TextView tv_num, tv_username, tv_invest_amount;
	}

}
